#ifndef HONORWALLWIDGET_H
#define HONORWALLWIDGET_H

#include <QWidget>
#include <QLabel>
#include <QPixmap>

namespace Ui {
class honorwallwidget;
}
class QPushButton;
class QScrollArea;
class QGridLayout;

constexpr int imgH=500;
constexpr int imgW=300;

class ClickableLabel :public QLabel{
    Q_OBJECT
public:
    explicit ClickableLabel(QWidget* parent=nullptr):QLabel(parent){}
signals:
    void clicked();
protected:
    void mousePressEvent(QMouseEvent *event) override{
        emit clicked();
        QLabel::mousePressEvent(event);
    }
};


class honorwallwidget : public QWidget
{
    Q_OBJECT

public:
    explicit honorwallwidget(QWidget *parent = nullptr);
    ~honorwallwidget();
private:
    void setupUI();
    void loadImagesFromDatabase();

    void addImage();
    void modifyImage();
    void deleteImage();
    void onImageClicked();
    void addImageToWall(const QString& imagePath);
    void addImageToUI(const QPixmap& pixmap);
    void reorderImages();


    QPushButton *addButton;
    QPushButton *modifyButton;
    QPushButton *deleteButton;
    QScrollArea *scrollArea;
    QWidget *contentWidget;
    QGridLayout *gridLayout;
    ClickableLabel *selectedLabel=nullptr;



private:
    Ui::honorwallwidget *ui;
};



#endif // HONORWALLWIDGET_H
